/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.buzzwords.domain;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author potlow
 */
@Entity
@Table(name = "buzzwords")
@NamedQueries({@NamedQuery(name = "Buzzword.findAll", query = "SELECT b FROM Buzzword b"), @NamedQuery(name = "Buzzword.findById", query = "SELECT b FROM Buzzword b WHERE b.id = :id"), @NamedQuery(name = "Buzzword.findByWord", query = "SELECT b FROM Buzzword b WHERE b.word = :word"), @NamedQuery(name = "Buzzword.findByCreated", query = "SELECT b FROM Buzzword b WHERE b.created = :created"), @NamedQuery(name = "Buzzword.findByUserId", query = "SELECT b FROM Buzzword b WHERE b.userId = :userId")})
public class Buzzword implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "word")
    private String word;
    @Basic(optional = false)
    @Lob
    @Column(name = "definition")
    private String definition;
    @Column(name = "created")
    @Temporal(TemporalType.TIMESTAMP)
    private Date created;
    @Basic(optional = false)
    @Column(name = "user_id")
    private int userId;

    public Buzzword() {
    }

    public Buzzword(Integer id) {
        this.id = id;
    }

    public Buzzword(Integer id, String word, String definition, int userId) {
        this.id = id;
        this.word = word;
        this.definition = definition;
        this.userId = userId;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getWord() {
        return word;
    }

    public void setWord(String word) {
        this.word = word;
    }

    public String getDefinition() {
        return definition;
    }

    public void setDefinition(String definition) {
        this.definition = definition;
    }

    public Date getCreated() {
        return created;
    }

    public void setCreated(Date created) {
        this.created = created;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Buzzword)) {
            return false;
        }
        Buzzword other = (Buzzword) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.buzzwords.model.Buzzword[id=" + id + "]";
    }

}
